﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace BLL
{
    public class ClothBLL
    {
        private readonly DAL.ClothDAL clothdal = new DAL.ClothDAL();
        /// <summary>
        /// 获取所有布料数据
        /// </summary>
        public DataTable getCloth()
        {
            return clothdal.getClothView("1=1");
        }
        /// <summary>
        /// 获取指定公司的ID布料数据
        /// </summary>
        public DataTable getClothViewByCompanyID(string companyid)
        {
            return clothdal.getClothView("companyID="+companyid);
        }

        /// <summary>
        /// 获取指定ID的布料数据
        /// </summary>
        public DataTable getClothViewByID(string id)
        {
            return clothdal.getClothView("ID=" + id);
        }

        /// <summary>
        /// 获取指定公司和号码的布料
        /// </summary>
        public DataTable getClothViewByNo(string companyid,string clothNo)
        {
            string limit="companyID="+companyid+" and clothNo='"+clothNo+"'";
            return clothdal.getClothView(limit);
        }

        /// <summary>
        /// 获取指定公司名称的布料
        /// </summary>
        public DataTable getClothViewByCompanyName(string companyName)
        {
            return clothdal.getClothView("shortName='"+companyName+"'");
        }

        public void addCloth(Albon.Model.Cloth cloth)
        {
            clothdal.addCloth(cloth);
        }
    }
}
